package voldemort.store.cachestore.impl;

import voldemort.store.cachestore.CacheBlock;
import voldemort.store.cachestore.Key;

import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;

/**
 * Created by IntelliJ IDEA.
 * User: mhsieh
 * Date: 1/26/11
 * Time: 7:06 PM
 * Support delay write back, intercept GC and check isDirty() to persist the data
 */
public class WriteBackBlock<T> extends SoftReference  {
    private final Key key;
    private final CacheBlock block;


    public WriteBackBlock(T object, ReferenceQueue referenceQueue, CacheBlock block, Key key) {
        super(object, referenceQueue);
        this.block = block;
        this.key = key;

    }

    public Key getKey() {
        return key;
    }

    public CacheBlock getBlock() {
        return block;
    }
}
